home *** CD-ROM | disk | FTP | other *** search
-
-
-
-
-
-
- .equ rawR,a3
- .equ rawG,a2
- .equ rawB,a0
- .equ pal,a1
- .equ rawpix,a0
-
- .equ palpix,d4
- .equ i,d3
- .equ match,d2
- .equ thismatch,d1
-
- .globl _Match
- _Match: moveml d2-d4/a2-a3,sp@-
- moveq #0,d0
- moveb rawpix@+,d0
- movel d0,rawR | .l -> an faster than .w -> an
- moveb rawpix@+,d0
- movel d0,rawG
- moveb rawpix@+,d0
- movel d0,rawB
-
- movew #0x7FFF,match | match never greater then 765 and ever positive
- movew #255,i
-
- loopM: moveq #0,thismatch
- moveb pal@+,thismatch
- subl rawR,thismatch | an -> .l faster than an -> .w
- bges .skipR
- negl thismatch
- .skipR: moveb pal@+,d0
- subl rawG,d0
- bges .skipG
- negl d0
- .skipG: addl d0,thismatch
- moveb pal@+,d0
- subl rawB,d0
- bges .skipB
- negl d0
- .skipB: addl d0,thismatch
- beqs fastMatch
- cmpw match,thismatch
- bges noMatch
- movew thismatch,match
- movew i,palpix
- noMatch:
- dbra i,loopM
- movew #255,d0
- subw palpix,d0
- moveml sp@+,d2-d4/a2-a3
- rts
- fastMatch:
- movew #255,d0
- subw i,d0
- moveml sp@+,d2-d4/a2-a3
- rts
-